//
//  WPDisButton.m
//  CaiPiao
//
//  Created by zhoup on 16/5/25.
//  Copyright © 2016年 zhoup. All rights reserved.
//

#import "WPDisButton.h"

@implementation WPDisButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView.contentMode = UIViewContentModeCenter;
    }
    return self;
}

/*
 从storyboard中加载
 */
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.imageView.contentMode = UIViewContentModeCenter;
    }
    return self;
}

-(CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGFloat w = self.width;
    CGFloat x = 0.75 * w;
    CGFloat y = 0;
    CGFloat width = 0.25 * w;
    CGFloat height = self.height;
    
    return CGRectMake(x, y, width, height);
    
}

-(CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGFloat w = self.width;
    
    CGFloat x = 0;
    CGFloat y = 0;
    CGFloat width = 0.75 * w;
    CGFloat height = self.height;
    
    return CGRectMake(x, y, width, height);
}


@end
